import React, { useCallback, useMemo, useState } from 'react'
import B from './B'
import C from './C'

export default function A() {
    console.log('A');
    const [count,setCount] = useState(0)
    // const handleFn = useMemo(() =>()=>setCount(pre => pre+1),[])//使用useMemo
    const handleFn = useCallback(() =>setCount(pre => pre+1),[])//使用useCallback
    
  return (
    <div>
        <h1>{count}</h1>
        <B fn={handleFn}/>
        <C />
    </div>
  )
}
